package test7;

import java.io.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Main {
    public static void main(String[] args) throws IOException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException {
        Properties p = new Properties();
        BufferedReader br = new BufferedReader(new FileReader("Java_11_23\\src\\test7\\prop.properties"));
        p.load(br);
        br.close();

        String className = (String) p.get("classname");
        String methodName = (String) p.get("method");

        Class clazz = Class.forName(className);
        Constructor con = clazz.getDeclaredConstructor();
        Object obj = con.newInstance();
        Method method = clazz.getDeclaredMethod(methodName);
        method.invoke(obj);
    };

    public static void write(Object obj) throws IOException, IllegalAccessException {

    }
}
